//
//  BKMyOrderFooterAutoReferesh.m
//  bestkeep
//
//  Created by Mr. Wu on 16/12/22.
//  Copyright © 2016年 utouu. All rights reserved.
//

#import "BKMyOrderFooterAutoReferesh.h"
#define RGB(R,G,B) [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1]
@interface BKMyOrderFooterAutoReferesh ()
@property(strong,nonatomic)UIImageView *arrowView;
@end
@implementation BKMyOrderFooterAutoReferesh
- (UIImageView *)arrowView
{
    if (!_arrowView) {
        _arrowView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"BKGDPullUp"]];
        
                }
    return _arrowView;
}

- (void)prepare
{
    [super prepare];
    [self setTitle:@"上拉可以加载更多" forState:MJRefreshStateIdle];
   [self setTitle:@"正在加载更多数据..." forState:MJRefreshStateRefreshing];
    [self setTitle:@" " forState:MJRefreshStateNoMoreData];
    self.stateLabel.textColor = RGB(73, 73, 73);
    self.stateLabel.font = [UIFont systemFontOfSize:14];
      [self addSubview:self.arrowView];
  }

#pragma mark 在这里设置子控件的位置和尺寸
- (void)placeSubviews
{
    [super placeSubviews];
    CGFloat loadingCenterX = self.mj_w * 0.5;
    loadingCenterX -= self.stateLabel.mj_textWith * 0.5 + self.labelLeftInset;
    CGFloat loadingCenterY = self.mj_h * 0.5;
    self.arrowView.center = CGPointMake(loadingCenterX, loadingCenterY);
}
-(void)setState:(MJRefreshState)state{
    [super setState:state];
    if (state == MJRefreshStateRefreshing) {
        self.arrowView.hidden = YES;
    }else{
        self.arrowView.hidden = NO;
    }    
}
#pragma mark 监听scrollView的contentOffset改变
- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change
{
    [super scrollViewContentOffsetDidChange:change];
}

#pragma mark 监听scrollView的contentSize改变
- (void)scrollViewContentSizeDidChange:(NSDictionary *)change
{
    [super scrollViewContentSizeDidChange:change];
}

#pragma mark 监听scrollView的拖拽状态改变
- (void)scrollViewPanStateDidChange:(NSDictionary *)change
{
    [super scrollViewPanStateDidChange:change];
}

@end
